home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / ColorSync™ 1.0.5 / Interfaces / CIncludes / CMApplication.h next >
Encoding:
C/C++ Source or Header  |  1994-04-11  |  9.9 KB  |  412 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CMApplication.h
  3.  
  4.     Copyright:    © 1984-1994 by Apple Computer, Inc., all rights reserved.
  5.  
  6. */
  7.  
  8. #ifndef __CMAPPLICATION__
  9. #define __CMAPPLICATION__
  10.  
  11. #ifndef __TYPES__
  12. #include <Types.h>
  13. /*    #include <ConditionalMacros.h>                                */
  14. /*    #include <MixedMode.h>                                        */
  15. /*        #include <Traps.h>                                        */
  16. #endif
  17.  
  18. #ifndef __QUICKDRAW__
  19. #include <Quickdraw.h>
  20. /*    #include <QuickdrawText.h>                                    */
  21. /*        #include <IntlResources.h>                                */
  22. #endif
  23.  
  24. #ifndef __PRINTING__
  25. #include <Printing.h>
  26. /*    #include <Dialogs.h>                                        */
  27. /*        #include <Windows.h>                                    */
  28. /*            #include <Events.h>                                    */
  29. /*                #include <OSUtils.h>                            */
  30. /*            #include <Controls.h>                                */
  31. /*                #include <Menus.h>                                */
  32. /*        #include <TextEdit.h>                                    */
  33. #endif
  34.  
  35. #define gestaltColorMatchingVersion 'cmtc'
  36.  
  37. enum {
  38.     gestaltColorSync10            = 0x0100,
  39.     gestaltColorSync11            = 0x0110,
  40.     gestaltColorSync104            = 0x0104,
  41.     gestaltColorSync105            = 0x0105
  42. };
  43.  
  44. #define gestaltColorMatchingAttr 'cmta'
  45.  
  46. enum {
  47.     gestaltHighLevelMatching    = 0,
  48.     gestaltColorMatchingLibLoaded = 1
  49. };
  50.  
  51. #define CMTrap 0xABEE
  52.  
  53. #define CMBeginProfile 220
  54.  
  55. #define CMEndProfile 221
  56.  
  57. #define CMEnableMatching 222
  58.  
  59. #define CMDisableMatching 223
  60.  
  61. #define kMatchCMMType 0x00000001
  62.  
  63. #define kMatchApplProfileVersion 0x00000002
  64.  
  65. #define kMatchDataType 0x00000004
  66.  
  67. #define kMatchDeviceType 0x00000008
  68.  
  69. #define kMatchDeviceManufacturer 0x00000010
  70.  
  71. #define kMatchDeviceModel 0x00000020
  72.  
  73. #define kMatchDeviceAttributes 0x00000040
  74.  
  75. #define kMatchFlags 0x00000080
  76.  
  77. #define kMatchOptions 0x00000100
  78.  
  79. #define kMatchWhite 0x00000200
  80.  
  81. #define kMatchBlack 0x00000400
  82.  
  83. #define kCMApplProfileVersion 0x0100
  84.  
  85. enum {
  86.     rgbData                        = 'RGB ',
  87.     cmykData                    = 'CMYK',
  88.     grayData                    = 'GRAY',
  89.     xyzData                        = 'XYZ '
  90. };
  91.  
  92. enum {
  93.     monitorDevice                = 'mntr',
  94.     scannerDevice                = 'scnr',
  95.     printerDevice                = 'prtr',
  96.     qdSystemDevice                = 'sys ',
  97.     qdGDevice                    = 'gdev'
  98. };
  99.  
  100. enum {
  101.     CMNativeMatchingPreferred    = 0x00000001,
  102.     CMTurnOffCache                = 0x00000002
  103. };
  104.  
  105. typedef long CMMatchFlag;
  106.  
  107. enum {
  108.     CMPerceptualMatch            = 0x0000,
  109.     CMColorimetricMatch            = 0x0001,
  110.     CMSaturationMatch            = 0x0002
  111. };
  112.  
  113. typedef long CMMatchOption;
  114.  
  115. typedef long CMMatchRef;
  116.  
  117. typedef long CWorld;
  118.  
  119. enum {
  120.     CMNoError                    = 0,
  121.     CMProfileError                = -170,
  122.     CMMethodError                = -171,
  123.     CMMemFullError                = -172,
  124.     CMUnimplementedError        = -173,
  125.     CMParamError                = -174,
  126.     CMMethodNotFound            = -175,
  127.     CMProfileNotFound            = -176,
  128.     CMProfilesIdentical            = -177,
  129.     CMCantConcatenateError        = -178,
  130.     CMCantXYZ                    = -179,
  131.     CMCantDeleteProfile            = -180,
  132.     CMUnsupportedDataType        = -181,
  133.     CMNoCurrentProfile            = -182
  134. };
  135.  
  136. typedef long CMError;
  137.  
  138. #if powerc
  139. #pragma options align=mac68k
  140. #endif
  141. struct XYZColor {
  142.     unsigned short                X;
  143.     unsigned short                Y;
  144.     unsigned short                Z;
  145. };
  146. #if powerc
  147. #pragma options align=reset
  148. #endif
  149.  
  150. typedef struct XYZColor XYZColor;
  151.  
  152. #if powerc
  153. #pragma options align=mac68k
  154. #endif
  155. struct CMYKColor {
  156.     unsigned short                cyan;
  157.     unsigned short                magenta;
  158.     unsigned short                yellow;
  159.     unsigned short                black;
  160. };
  161. #if powerc
  162. #pragma options align=reset
  163. #endif
  164.  
  165. typedef struct CMYKColor CMYKColor;
  166.  
  167. #if powerc
  168. #pragma options align=mac68k
  169. #endif
  170. union CMColor {
  171.     RGBColor                    rgb;
  172.     XYZColor                    xyz;
  173.     CMYKColor                    cmyk;
  174. };
  175. #if powerc
  176. #pragma options align=reset
  177. #endif
  178.  
  179. typedef union CMColor CMColor, *CMColorList;
  180.  
  181. typedef long *CMGamutResult;
  182.  
  183. #if powerc
  184. #pragma options align=mac68k
  185. #endif
  186. struct CMHeader {
  187.     unsigned long                size;
  188.     OSType                        CMMType;
  189.     unsigned long                applProfileVersion;
  190.     OSType                        dataType;
  191.     OSType                        deviceType;
  192.     OSType                        deviceManufacturer;
  193.     unsigned long                deviceModel;
  194.     unsigned long                deviceAttributes[2];
  195.     unsigned long                profileNameOffset;
  196.     unsigned long                customDataOffset;
  197.     CMMatchFlag                    flags;
  198.     CMMatchOption                options;
  199.     XYZColor                    white;
  200.     XYZColor                    black;
  201. };
  202. #if powerc
  203. #pragma options align=reset
  204. #endif
  205.  
  206. typedef struct CMHeader CMHeader;
  207.  
  208. #if powerc
  209. #pragma options align=mac68k
  210. #endif
  211. struct CMProfileSearchRecord {
  212.     CMHeader                    header;
  213.     unsigned long                fieldMask;
  214.     unsigned long                reserved[2];
  215. };
  216. #if powerc
  217. #pragma options align=reset
  218. #endif
  219.  
  220. typedef struct CMProfileSearchRecord CMProfileSearchRecord, **CMProfileSearchRecordHandle;
  221.  
  222. #if powerc
  223. #pragma options align=mac68k
  224. #endif
  225. struct CMProfileChromaticities {
  226.     XYZColor                    red;
  227.     XYZColor                    green;
  228.     XYZColor                    blue;
  229.     XYZColor                    cyan;
  230.     XYZColor                    magenta;
  231.     XYZColor                    yellow;
  232. };
  233. #if powerc
  234. #pragma options align=reset
  235. #endif
  236.  
  237. typedef struct CMProfileChromaticities CMProfileChromaticities;
  238.  
  239. typedef unsigned short CMResponseData;
  240.  
  241. #if powerc
  242. #pragma options align=mac68k
  243. #endif
  244. struct IString {
  245.     ScriptCode                    theScript;
  246.     Str63                        theString;
  247. };
  248. #if powerc
  249. #pragma options align=reset
  250. #endif
  251.  
  252. typedef struct IString IString, *IStringPtr, **IStringHandle;
  253.  
  254. enum {
  255.     grayResponse                = 0,
  256.     redResponse,
  257.     greenResponse,
  258.     blueResponse,
  259.     cyanResponse,
  260.     magentaResponse,
  261.     yellowResponse,
  262.     ucrResponse,
  263.     bgResponse,
  264.     onePlusLastResponse
  265. };
  266.  
  267. typedef long responseColor;
  268.  
  269. #if powerc
  270. #pragma options align=mac68k
  271. #endif
  272. struct CMProfileResponse {
  273.     unsigned short                counts[onePlusLastResponse];
  274.     CMResponseData                data[1];
  275. };
  276. #if powerc
  277. #pragma options align=reset
  278. #endif
  279.  
  280. typedef struct CMProfileResponse CMProfileResponse;
  281.  
  282. #if powerc
  283. #pragma options align=mac68k
  284. #endif
  285. struct CMProfile {
  286.     CMHeader                    header;
  287.     CMProfileChromaticities        profile;
  288.     CMProfileResponse            response;
  289.     IString                        profileName;
  290.     char                        customData[1];
  291. };
  292. #if powerc
  293. #pragma options align=reset
  294. #endif
  295.  
  296. typedef struct CMProfile CMProfile, *CMProfilePtr, **CMProfileHandle;
  297.  
  298. typedef pascal Boolean (*PixMapCallBackProcPtr)(long progress, long refCon);
  299.  
  300. enum {
  301.     uppPixMapCallBackProcInfo = kPascalStackBased
  302.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  303.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  304.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  305. };
  306.  
  307. #if USESROUTINEDESCRIPTORS
  308. typedef UniversalProcPtr PixMapCallBackUPP;
  309.  
  310. #define CallPixMapCallBackProc(userRoutine, progress, refCon)        \
  311.         CallUniversalProc((ProcPtr)userRoutine, uppPixMapCallBackProcInfo, progress, refCon)
  312. #define NewPixMapCallBackProc(userRoutine)        \
  313.         (PixMapCallBackUPP) NewRoutineDescriptor((ProcPtr)userRoutine, uppPixMapCallBackProcInfo, GetCurrentISA())
  314. #else
  315. typedef PixMapCallBackProcPtr PixMapCallBackUPP;
  316.  
  317. #define CallPixMapCallBackProc(userRoutine, progress, refCon)        \
  318.         (*userRoutine)(progress, refCon)
  319. #define NewPixMapCallBackProc(userRoutine)        \
  320.         (PixMapCallBackUPP)(userRoutine)
  321. #endif
  322.  
  323. enum {
  324.     enableColorMatchingOp        = 12,
  325.     registerProfileOp            = 13
  326. };
  327.  
  328. #if powerc
  329. #pragma options align=mac68k
  330. #endif
  331. struct TEnableColorMatchingBlk {
  332.     short                        iOpCode;
  333.     short                        iError;
  334.     long                        lReserved;
  335.     THPrint                        hPrint;
  336.     Boolean                        fEnableIt;
  337. };
  338. #if powerc
  339. #pragma options align=reset
  340. #endif
  341.  
  342. typedef struct TEnableColorMatchingBlk TEnableColorMatchingBlk;
  343.  
  344. #if powerc
  345. #pragma options align=mac68k
  346. #endif
  347. struct TRegisterProfileBlk {
  348.     short                        iOpCode;
  349.     short                        iError;
  350.     long                        lReserved;
  351.     THPrint                        hPrint;
  352.     Boolean                        fRegisterIt;
  353. };
  354. #if powerc
  355. #pragma options align=reset
  356. #endif
  357.  
  358. typedef struct TRegisterProfileBlk TRegisterProfileBlk;
  359.  
  360. #ifdef __cplusplus
  361. extern "C" {
  362. #endif
  363.  
  364. #define CMCall(selector, argsize) {0x203c,argsize,selector,CMTrap}
  365.  
  366. extern pascal CMError BeginMatching(CMProfileHandle src, CMProfileHandle dst, CMMatchRef *myRef)
  367.  FOURWORDINLINE(0x203c, 0x000C, 10, 0xABEE);
  368. extern pascal void EndMatching(CMMatchRef myRef)
  369.  FOURWORDINLINE(0x203c, 0x0004, 11, 0xABEE);
  370. extern pascal CMError GetProfile(long deviceType, long refNum, CMProfileHandle aProfile, CMProfileHandle *returnedProfile)
  371.  FOURWORDINLINE(0x203c, 0x0010, 5, 0xABEE);
  372. extern pascal CMError SetProfile(long deviceType, long refNum, CMProfileHandle newProfile)
  373.  FOURWORDINLINE(0x203c, 0x000c, 6, 0xABEE);
  374. extern pascal CMError SetProfileDescription(long deviceType, long refNum, long deviceData, CMProfileHandle hProfile)
  375.  FOURWORDINLINE(0x203c, 0x0010, 16, 0xABEE);
  376. extern pascal CMError GetColorSyncFolderSpec(short vRefNum, Boolean createFolder, short *foundVRefNum, long *foundDirID)
  377.  FOURWORDINLINE(0x203c, 0x000c, 17, 0xABEE);
  378. extern pascal CMError GetIndexedProfile(long deviceType, long refNum, CMProfileSearchRecordHandle search, CMProfileHandle *returnProfile, long *index)
  379.  FOURWORDINLINE(0x203c, 0x0014, 18, 0xABEE);
  380. extern pascal CMError DeleteDeviceProfile(long deviceType, long refNum, CMProfileHandle deleteMe)
  381.  FOURWORDINLINE(0x203c, 0x000C, 19, 0xABEE);
  382. extern pascal CMError UseProfile(CMProfileHandle profile)
  383.  FOURWORDINLINE(0x203c, 0x0004, 8, 0xABEE);
  384. extern pascal void DrawMatchedPicture(PicHandle myPicture, CMProfileHandle dst, Rect *myRect)
  385.  FOURWORDINLINE(0x203c, 0x000C, 9, 0xABEE);
  386. extern pascal void EnableMatching(Boolean enableIt)
  387.  FOURWORDINLINE(0x203c, 0x0002, 13, 0xABEE);
  388. extern pascal CMError ConcatenateProfiles(CMProfileHandle thru, CMProfileHandle dst, CMProfileHandle *newDst)
  389.  FOURWORDINLINE(0x203c, 0x000C, 12, 0xABEE);
  390. extern pascal void GetProfileName(CMProfileHandle myProfile, IString *IStringResult)
  391.  FOURWORDINLINE(0x203c, 0x0008, 14, 0xABEE);
  392. extern pascal long GetProfileAdditionalDataOffset(CMProfileHandle myProfile)
  393.  FOURWORDINLINE(0x203c, 0x0004, 15, 0xABEE);
  394. extern pascal CMError CWNewColorWorld(CWorld *myCWorld, CMProfileHandle src, CMProfileHandle dst)
  395.  FOURWORDINLINE(0x203c, 0x000C, 0, 0xABEE);
  396. extern pascal void CWDisposeColorWorld(CWorld myCWorld)
  397.  FOURWORDINLINE(0x203c, 0x0004, 1, 0xABEE);
  398. extern pascal CMError CWMatchColors(CWorld myCWorld, CMColorList myColors, long count)
  399.  FOURWORDINLINE(0x203c, 0x000c, 2, 0xABEE);
  400. extern pascal CMError CWCheckColors(CWorld myCWorld, CMColorList myColors, long count, CMGamutResult result)
  401.  FOURWORDINLINE(0x203c, 0x0010, 3, 0xABEE);
  402. extern pascal CMError CWMatchPixMap(CWorld myCWorld, PixMap *myPixMap, PixMapCallBackUPP progressProc, long refCon)
  403.  FOURWORDINLINE(0x203c, 0x0010, 4, 0xABEE);
  404. extern pascal CMError CWCheckPixMap(CWorld myCWorld, PixMap *myPixMap, PixMapCallBackUPP progressProc, long refCon, BitMap *resultBitMap)
  405.  FOURWORDINLINE(0x203c, 0x0014, 7, 0xABEE);
  406. #ifdef __cplusplus
  407. }
  408. #endif
  409.  
  410. #endif
  411.  
  412.